package com.ordertracker.protocol;


import java.io.Serializable;
import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import com.ordertracker.client.ClientSession;
import com.ordertracker.entity.Client;
import com.ordertracker.entity.Employee;
import com.ordertracker.entity.Organization;

@XmlRootElement
public class ResponseAuthorization implements Serializable {
    private static final long serialVersionUID = 4271369130045516184L;
    
    private ClientSession clientSession;
    private Client client;
    private Employee employee;

    public ResponseAuthorization() {
    }

    public ResponseAuthorization(ClientSession clientSession) {
        this.clientSession = clientSession;
    }

    public ResponseAuthorization(ClientSession clientSession, Client client,  Employee employee) {
        this.clientSession = clientSession;
        this.client = client;
        this.employee = employee;
    }

    @XmlElement(nillable = false)
    public ClientSession getClientSession() {
        return clientSession;
    }

    @XmlElement(nillable = false)
    public Client getClient() {
        return client;
    }

    public void setClient(Client client) {
        this.client = client;
    }

    @XmlElement(nillable = true)
    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ResponseAuthorization)) return false;

        ResponseAuthorization that = (ResponseAuthorization) o;

        if (client != null ? !client.equals(that.client) : that.client != null) return false;
        if (!clientSession.equals(that.clientSession)) return false;
        if (employee != null ? !employee.equals(that.employee) : that.employee != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = clientSession.hashCode();
        result = 31 * result + (client != null ? client.hashCode() : 0);
        result = 31 * result + (employee != null ? employee.hashCode() : 0);
        return result;
    }
}
